home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / complib / stgsja.z / stgsja
Text File  |  1998-10-30  |  11KB  |  331 lines

  1.  
  2.  
  3.  
  4. SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      STGSJA - compute the generalized singular value decomposition (GSVD) of
  10.      two real upper triangular (or trapezoidal) matrices A and B
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      SUBROUTINE STGSJA( JOBU, JOBV, JOBQ, M, P, N, K, L, A, LDA, B, LDB, TOLA,
  14.                         TOLB, ALPHA, BETA, U, LDU, V, LDV, Q, LDQ, WORK,
  15.                         NCYCLE, INFO )
  16.  
  17.          CHARACTER      JOBQ, JOBU, JOBV
  18.  
  19.          INTEGER        INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, NCYCLE, P
  20.  
  21.          REAL           TOLA, TOLB
  22.  
  23.          REAL           ALPHA( * ), BETA( * ), A( LDA, * ), B( LDB, * ), Q(
  24.                         LDQ, * ), U( LDU, * ), V( LDV, * ), WORK( * )
  25.  
  26. PPPPUUUURRRRPPPPOOOOSSSSEEEE
  27.      STGSJA computes the generalized singular value decomposition (GSVD) of
  28.      two real upper triangular (or trapezoidal) matrices A and B.
  29.  
  30.      On entry, it is assumed that matrices A and B have the following forms,
  31.      which may be obtained by the preprocessing subroutine SGGSVP from a
  32.      general M-by-N matrix A and P-by-N matrix B:
  33.  
  34.                   N-K-L  K    L
  35.         A =    K ( 0    A12  A13 ) if M-K-L >= 0;
  36.                L ( 0     0   A23 )
  37.            M-K-L ( 0     0    0  )
  38.  
  39.                 N-K-L  K    L
  40.         A =  K ( 0    A12  A13 ) if M-K-L < 0;
  41.            M-K ( 0     0   A23 )
  42.  
  43.                 N-K-L  K    L
  44.         B =  L ( 0     0   B13 )
  45.            P-L ( 0     0    0  )
  46.  
  47.      where the K-by-K matrix A12 and L-by-L matrix B13 are nonsingular upper
  48.      triangular; A23 is L-by-L upper triangular if M-K-L >= 0, otherwise A23
  49.      is (M-K)-by-L upper trapezoidal.
  50.  
  51.      On exit,
  52.  
  53.                  U'*A*Q = D1*( 0 R ),    V'*B*Q = D2*( 0 R ),
  54.  
  55.      where U, V and Q are orthogonal matrices, Z' denotes the transpose of Z,
  56.      R is a nonsingular upper triangular matrix, and D1 and D2 are
  57.      ``diagonal'' matrices, which are of the following structures:
  58.  
  59.      If M-K-L >= 0,
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  71.  
  72.  
  73.  
  74.                          K  L
  75.             D1 =     K ( I  0 )
  76.                      L ( 0  C )
  77.                  M-K-L ( 0  0 )
  78.  
  79.                        K  L
  80.             D2 = L   ( 0  S )
  81.                  P-L ( 0  0 )
  82.  
  83.                     N-K-L  K    L
  84.        ( 0 R ) = K (  0   R11  R12 ) K
  85.                  L (  0    0   R22 ) L
  86.  
  87.      where
  88.  
  89.        C = diag( ALPHA(K+1), ... , ALPHA(K+L) ),
  90.        S = diag( BETA(K+1),  ... , BETA(K+L) ),
  91.        C**2 + S**2 = I.
  92.  
  93.        R is stored in A(1:K+L,N-K-L+1:N) on exit.
  94.  
  95.      If M-K-L < 0,
  96.  
  97.                     K M-K K+L-M
  98.          D1 =   K ( I  0    0   )
  99.               M-K ( 0  C    0   )
  100.  
  101.                       K M-K K+L-M
  102.          D2 =   M-K ( 0  S    0   )
  103.               K+L-M ( 0  0    I   )
  104.                 P-L ( 0  0    0   )
  105.  
  106.                     N-K-L  K   M-K  K+L-M
  107.  
  108.                M-K ( 0     0   R22  R23  )
  109.              K+L-M ( 0     0    0   R33  )
  110.  
  111.      where
  112.      C = diag( ALPHA(K+1), ... , ALPHA(M) ),
  113.      S = diag( BETA(K+1),  ... , BETA(M) ),
  114.      C**2 + S**2 = I.
  115.  
  116.      R = ( R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N) and R33 is stored
  117.          (  0  R22 R23 )
  118.      in B(M-K+1:L,N+M-K-L+1:N) on exit.
  119.  
  120.      The computation of the orthogonal transformation matrices U, V or Q is
  121.      optional.  These matrices may either be formed explicitly, or they may be
  122.      postmultiplied into input matrices U1, V1, or Q1.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  137.  
  138.  
  139.  
  140. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  141.      JOBU    (input) CHARACTER*1
  142.              = 'U':  U must contain an orthogonal matrix U1 on entry, and the
  143.              product U1*U is returned; = 'I':  U is initialized to the unit
  144.              matrix, and the orthogonal matrix U is returned; = 'N':  U is not
  145.              computed.
  146.  
  147.      JOBV    (input) CHARACTER*1
  148.              = 'V':  V must contain an orthogonal matrix V1 on entry, and the
  149.              product V1*V is returned; = 'I':  V is initialized to the unit
  150.              matrix, and the orthogonal matrix V is returned; = 'N':  V is not
  151.              computed.
  152.  
  153.      JOBQ    (input) CHARACTER*1
  154.              = 'Q':  Q must contain an orthogonal matrix Q1 on entry, and the
  155.              product Q1*Q is returned; = 'I':  Q is initialized to the unit
  156.              matrix, and the orthogonal matrix Q is returned; = 'N':  Q is not
  157.              computed.
  158.  
  159.      M       (input) INTEGER
  160.              The number of rows of the matrix A.  M >= 0.
  161.  
  162.      P       (input) INTEGER
  163.              The number of rows of the matrix B.  P >= 0.
  164.  
  165.      N       (input) INTEGER
  166.              The number of columns of the matrices A and B.  N >= 0.
  167.  
  168.      K       (input) INTEGER
  169.              L       (input) INTEGER K and L specify the subblocks in the
  170.              input matrices A and B:
  171.              A23 = A(K+1:MIN(K+L,M),N-L+1:N) and B13 = B(1:L,N-L+1:N) of A and
  172.              B, whose GSVD is going to be computed by STGSJA.  See Further
  173.              details.
  174.  
  175.      A       (input/output) REAL array, dimension (LDA,N)
  176.              On entry, the M-by-N matrix A.  On exit, A(N-K+1:N,1:MIN(K+L,M) )
  177.              contains the triangular matrix R or part of R.  See Purpose for
  178.              details.
  179.  
  180.      LDA     (input) INTEGER
  181.              The leading dimension of the array A. LDA >= max(1,M).
  182.  
  183.      B       (input/output) REAL array, dimension (LDB,N)
  184.              On entry, the P-by-N matrix B.  On exit, if necessary, B(M-
  185.              K+1:L,N+M-K-L+1:N) contains a part of R.  See Purpose for
  186.              details.
  187.  
  188.      LDB     (input) INTEGER
  189.              The leading dimension of the array B. LDB >= max(1,P).
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  203.  
  204.  
  205.  
  206.      TOLA    (input) REAL
  207.              TOLB    (input) REAL TOLA and TOLB are the convergence criteria
  208.              for the Jacobi- Kogbetliantz iteration procedure. Generally, they
  209.              are the same as used in the preprocessing step, say TOLA =
  210.              max(M,N)*norm(A)*MACHEPS, TOLB = max(P,N)*norm(B)*MACHEPS.
  211.  
  212.      ALPHA   (output) REAL array, dimension (N)
  213.              BETA    (output) REAL array, dimension (N) On exit, ALPHA and
  214.              BETA contain the generalized singular value pairs of A and B;
  215.              ALPHA(1:K) = 1,
  216.              BETA(1:K)  = 0, and if M-K-L >= 0, ALPHA(K+1:K+L) = diag(C),
  217.              BETA(K+1:K+L)  = diag(S), or if M-K-L < 0, ALPHA(K+1:M)= C,
  218.              ALPHA(M+1:K+L)= 0
  219.              BETA(K+1:M) = S, BETA(M+1:K+L) = 1.  Furthermore, if K+L < N,
  220.              ALPHA(K+L+1:N) = 0 and
  221.              BETA(K+L+1:N)  = 0.
  222.  
  223.      U       (input/output) REAL array, dimension (LDU,M)
  224.              On entry, if JOBU = 'U', U must contain a matrix U1 (usually the
  225.              orthogonal matrix returned by SGGSVP).  On exit, if JOBU = 'I', U
  226.              contains the orthogonal matrix U; if JOBU = 'U', U contains the
  227.              product U1*U.  If JOBU = 'N', U is not referenced.
  228.  
  229.      LDU     (input) INTEGER
  230.              The leading dimension of the array U. LDU >= max(1,M) if JOBU =
  231.              'U'; LDU >= 1 otherwise.
  232.  
  233.      V       (input/output) REAL array, dimension (LDV,P)
  234.              On entry, if JOBV = 'V', V must contain a matrix V1 (usually the
  235.              orthogonal matrix returned by SGGSVP).  On exit, if JOBV = 'I', V
  236.              contains the orthogonal matrix V; if JOBV = 'V', V contains the
  237.              product V1*V.  If JOBV = 'N', V is not referenced.
  238.  
  239.      LDV     (input) INTEGER
  240.              The leading dimension of the array V. LDV >= max(1,P) if JOBV =
  241.              'V'; LDV >= 1 otherwise.
  242.  
  243.      Q       (input/output) REAL array, dimension (LDQ,N)
  244.              On entry, if JOBQ = 'Q', Q must contain a matrix Q1 (usually the
  245.              orthogonal matrix returned by SGGSVP).  On exit, if JOBQ = 'I', Q
  246.              contains the orthogonal matrix Q; if JOBQ = 'Q', Q contains the
  247.              product Q1*Q.  If JOBQ = 'N', Q is not referenced.
  248.  
  249.      LDQ     (input) INTEGER
  250.              The leading dimension of the array Q. LDQ >= max(1,N) if JOBQ =
  251.              'Q'; LDQ >= 1 otherwise.
  252.  
  253.      WORK    (workspace) REAL array, dimension (2*N)
  254.  
  255.      NCYCLE  (output) INTEGER
  256.              The number of cycles required for convergence.
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))                                                          SSSSTTTTGGGGSSSSJJJJAAAA((((3333FFFF))))
  269.  
  270.  
  271.  
  272.      INFO    (output) INTEGER
  273.              = 0:  successful exit
  274.              < 0:  if INFO = -i, the i-th argument had an illegal value.
  275.              = 1:  the procedure does not converge after MAXIT cycles.
  276.  
  277. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  278.      MAXIT   INTEGER
  279.              MAXIT specifies the total loops that the iterative procedure may
  280.              take. If after MAXIT cycles, the routine fails to converge, we
  281.              return INFO = 1.
  282.  
  283.              Further Details ===============
  284.  
  285.              STGSJA essentially uses a variant of Kogbetliantz algorithm to
  286.              reduce min(L,M-K)-by-L triangular (or trapezoidal) matrix A23 and
  287.              L-by-L matrix B13 to the form:
  288.  
  289.              U1'*A13*Q1 = C1*R1; V1'*B13*Q1 = S1*R1,
  290.  
  291.              where U1, V1 and Q1 are orthogonal matrix, and Z' is the
  292.              transpose of Z.  C1 and S1 are diagonal matrices satisfying
  293.  
  294.              C1**2 + S1**2 = I,
  295.  
  296.              and R1 is an L-by-L nonsingular upper triangular matrix.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.